package GameObjects;

import org.jbox2d.dynamics.World;
import org.mt4j.MTApplication;
import org.mt4j.util.math.Vector3D;
import advanced.physics.physicsShapes.PhysicsRectangle;
import processing.core.PApplet;
import util.BrickColor;


public class GameBrick extends PhysicsRectangle{
	
	private short strenght;

	public GameBrick(Vector3D centerPosition, float width, float height,
			MTApplication app, World world, float density, float friction,
			float restitution, float scale) {
		super(centerPosition, width, height, app, world, density, friction,
				restitution, scale);
		strenght = 1;
	}
	
	public GameBrick(Vector3D _centerPosition, float _height, float _width, MTApplication _app, World _world, float scale, String _strenght){
		super(_centerPosition, _height, _width, _app, _world, 0, 0, 0, scale);
		
		strenght = Short.parseShort(_strenght);
		setFillColor(BrickColor.valueOf("col"+_strenght).color());
	}
	
	/**
	 * Gettermethod for the strenght of the brick
	 * @return
	 */
	public short getStrenght(){
		return strenght;
	}
	
	/**
	 * Method to decrease the strenght of a block for one and give the new strenght back
	 * @return
	 */
	public short decreaseStrenght(){
		strenght--;
		if(strenght > 0)
			setFillColor(BrickColor.valueOf("col"+strenght).color());
		return strenght;
	}

}
